package validationTestSuite.tests
{
	import com.google.code.flexmetavalidator.metavalidation.MetaValidator;
	
	import mx.collections.ArrayCollection;
	import mx.collections.ArrayList;
	
	import org.flexunit.Assert;
	import org.flexunit.asserts.assertFalse;
	import org.flexunit.asserts.assertTrue;
	
	import validationTestSuite.tests.vo.ListNotEmptyObject;
	import validationTestSuite.tests.vo.NotNullObject;
	
	public class ListNotEmptyTest extends MetaValidatorTest
	{
		public function ListNotEmptyTest()
		{
			super();
		}
		
		[Test]
		public function testArray():void
		{
			var object : ListNotEmptyObject;
			var testResult : Boolean;
			
			object = new ListNotEmptyObject();
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varArray = new Array();
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			object.varArray = null;
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		[Test]
		public function testArrayList():void
		{
			var object : ListNotEmptyObject;
			var testResult : Boolean;
			
			object = new ListNotEmptyObject();
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varArrayList = new ArrayList();
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			object.varArrayList = null;
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		[Test]
		public function testArrayCollection():void
		{
			var object : ListNotEmptyObject;
			var testResult : Boolean;
			
			object = new ListNotEmptyObject();
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varArrayCollection = new ArrayCollection();
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			object.varArrayCollection = null;
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		
	}
}